<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修德抄经堂</title>
</head>
<body>
    <script src="../bower_components/jquery/dist/jquery.js"></script>
    <script>
        function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var result = document.location.search.substr(1).match(reg);
            return result ? encodeURI(result[2]) : null;
        }
        var code = getUrlParam('code');
        $.ajax({
            url: '/fe/user/login/authorization',
            data: {
                "code": code,
            },
            success: function (data) {
                var lastdate = new Date().getTime();
                localStorage.setItem('lastdate',lastdate);
                var openid = data.data.openid;
                localStorage.setItem('openid',openid);
                var backHref = localStorage.getItem('backHref');
                location.href = backHref;
                window.localStorage.setItem('uid', data.uid);
            },
            error: function (error) {
                console.log(error);
            }
        })
    </script>
</body>
</html>